﻿<%@ Page Language="VB" MasterPageFile="~/WebForm/MasterPage.master" AutoEventWireup="false"
    CodeFile="ManageWorkRecord.aspx.vb" Inherits="WebForm_ManageWorkRecord" %>

<%@ Register Src="~/WebForm/ManageWorkRecord/SearchCleanPlan.ascx" TagName="SearchCleanPlan"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/AddCleanPlan.ascx" TagName="AddCleanPlan"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/SearchDirtyHeader.ascx" TagName="SearchDirtyHeader"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/AddDirtyHeader.ascx" TagName="AddDirtyHeader"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/SearchWorkRecord.ascx" TagName="SearchWorkRecord"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/ImportWorkRecord.ascx" TagName="ImportWorkRecord"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/ManageWorkRecord/ImportHour.ascx" TagName="ImportHour" TagPrefix="My" %>

<script runat="server">
    Protected Sub listOrgV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
        If Me.CanAdmin = True Then
            listOrgV2.DataSource = MyObj.GetDDLDirectOrganizationData()
        Else

            listOrgV2.DataSource = MyObj.GetOrganizationData(clsAuth.GetUser.VolunteerLeader)
        End If
            
        listOrgV2.DataValueField = "UOrganizationID"
        listOrgV2.DataTextField = "OrganizationName"
    End Sub
    Protected Sub listVOrgV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
      

            
        listVOrgV2.DataSource = MyObj.GetVOrganizationData(UOrganizationID)
  
   

        listVOrgV2.DataTextField = "VOrganizationName"
        listVOrgV2.DataValueField = "VOrganizationID"
 
    End Sub

    Protected Sub listPlanItemTypeV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
        listPlanItemTypeV2.DataTextField = "Text"
        listPlanItemTypeV2.DataValueField = "Value"
        listPlanItemTypeV2.DataSource = MyObj.GetCodeMappingData("CleanPlan", "ItemType")

    End Sub

    Protected Sub listWorkItemV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
        listWorkItemV2.DataTextField = "Text"
        listWorkItemV2.DataValueField = "Value"
        listWorkItemV2.DataSource = MyObj.GetCodeMappingData("WorkHourRecord", "WorkType")

    End Sub
    Protected Sub listCleanPlanV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)

        listCleanPlanV2.DataTextField = "PlanName"
        listCleanPlanV2.DataValueField = "PlanID"
        Dim wmManager As New WorkRecordManager
        listCleanPlanV2.DataSource = wmManager.GetDDLCleanPlan(Me.SearchCleanPlan1.UOrganizationID, Me.SearchCleanPlan1.PlanItemType, Me.SearchCleanPlan1.Year)

    End Sub
    Protected Sub listPleanNameV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
       
        Dim wmManager As New WorkRecordManager
        If Me.SearchWorkRecord1.WorkItem = "FindDirtyAward" Or Me.SearchWorkRecord1.WorkItem = "FindDirtyHeader" Then
            listPleanNameV2.DataTextField = "FindDirtyName"
            listPleanNameV2.DataValueField = "FindDirtyHeaderID"
            listPleanNameV2.DataSource = wmManager.GetDDLPlanNameAsDirty()
        Else
            listPleanNameV2.DataTextField = "PlanName"
            listPleanNameV2.DataValueField = "PlanID"
            listPleanNameV2.DataSource = wmManager.GetDDLPlanNameAsClean(Me.SearchWorkRecord1.OrganizationID)
        End If

    End Sub
    Protected Sub listRegionV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim wmManager As New WorkRecordManager
        listRegionV2.DataValueField = "RegionID"
        listRegionV2.DataTextField = "RegionName"
        listRegionV2.DataSource = wmManager.GetDDLRegion()
    End Sub

    Protected Sub listVillageNameV2_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim wmManager As New WorkRecordManager
        listVillageNameV2.DataValueField = "RegionID"
        listVillageNameV2.DataTextField = "RegionName"
        listVillageNameV2.DataSource = wmManager.GetDDLVillageName(Me.SearchDirtyHeader1.ParentID)
    End Sub
   </script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
  <asp:Panel ID="pnlOrg" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upOrgV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listOrgV2" runat="server" OnDataBinding="listOrgV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlVOrg" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upVOrgV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listVOrgV2" runat="server" OnDataBinding="listVOrgV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlPlanItemType" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upPlanItemTypeV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listPlanItemTypeV2" runat="server" OnDataBinding="listPlanItemTypeV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlWorkItem" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upWorkItemV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listWorkItemV2" runat="server" OnDataBinding="listWorkItemV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlCleanPlan" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upCleanPlanV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listCleanPlanV2" runat="server" OnDataBinding="listCleanPlanV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlPleanName" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upPleanNameV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listPleanNameV2" runat="server" OnDataBinding="listPleanNameV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlRegion" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upRegionV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listRegionV2" runat="server" OnDataBinding="listRegionV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
  <asp:Panel ID="pnlVillageName" runat="server" SkinID="popup">
    <asp:UpdatePanel ID="upVillageNameV2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <My:SimpleListControl ID="listVillageNameV2" runat="server" OnDataBinding="listVillageNameV2_DataBinding"></My:SimpleListControl>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
    <table width="100%" align="Center">
        <tr>
            <td align="center">   
                <asp:Label ID="Title" runat="server" SkinID="title" Text="<%$ Resources:Title %>"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:LinkButton ID="lbtnAddPlan" runat="server" Text="<%$ Resources:AddPlan %>" Visible="false"></asp:LinkButton>
&nbsp;
                <asp:LinkButton ID="lbtnAddDirty" runat="server" Text="<%$ Resources:AddDirty %>" Visible="false"></asp:LinkButton>
            </td>
        </tr>
        <tr>
            <td>
<%--                <asp:UpdatePanel ID="up" runat="server">
                    <ContentTemplate>--%>
                        <table width="95%" align="center">
                            <tr>
                                <td>
                                    <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" AutoPostBack="false"
                                        ActiveTabIndex="0" >
                                        <ajaxToolkit:TabPanel ID="SearchCleanPlanTabPanel" runat="server" HeaderText="<%$ Resources:SearchCleanPlan %>">
                                            <ContentTemplate>
                                                <My:MyMultiView ID="mvClean" runat="server"  ActiveViewIndex="0">
                                                    <My:MyView ID="vwSearch" runat="server">
                                                        <My:SearchCleanPlan ID="SearchCleanPlan1" runat="server" />
                                                    </My:MyView>
                                                    <My:MyView ID="vwAdd" runat="server">
                                                        <table width="100%">
                                                            <tr>
                                                                <td align="left">
                                                                    <asp:LinkButton ID="lbtnReturn" runat="server" Text="<%$ Resources:Return %>"></asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                          </table>
                                                          <My:AddCleanPlan ID="AddCleanPlan1" runat="server" />
                                                    </My:MyView>
                                                </My:MyMultiView>
                                            </ContentTemplate>
                                        </ajaxToolkit:TabPanel>
                                        <ajaxToolkit:TabPanel ID="SearchDirtyHeaderTabPanel" runat="server" HeaderText="<%$ Resources:SearchDirtyHeader %>">
                                            <ContentTemplate>
                                                  <My:MyMultiView ID="mvDirty" runat="server"  ActiveViewIndex="0">
                                                        <My:MyView ID="vwDySearch" runat="server">
                                                            <My:SearchDirtyHeader ID="SearchDirtyHeader1" runat="server" />
                                                        </My:MyView>
                                                        <My:MyView ID="vwDyAdd" runat="server">
                                                           <table width="100%">
                                                                <tr>
                                                                    <td align="left">
                                                                        <asp:LinkButton ID="lbtnDyReturn" runat="server" Text="<%$ Resources:Return %>"></asp:LinkButton>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <My:AddDirtyHeader ID="AddDirtyHeader1" runat="server" />
                                                        </My:MyView>
                                                  </My:MyMultiView>
                                            </ContentTemplate>
                                        </ajaxToolkit:TabPanel>
                                        <ajaxToolkit:TabPanel ID="SearchWorkRecordTabPanel" runat="server" HeaderText="<%$ Resources:SearchWorkRecord %>"><ContentTemplate><My:SearchWorkRecord ID="SearchWorkRecord1" runat="server" /></ContentTemplate></ajaxToolkit:TabPanel>
                                        <ajaxToolkit:TabPanel ID="ImportWorkRecordTabPanel" runat="server" HeaderText="<%$ Resources:ImportWorkRecord %>"><ContentTemplate><My:ImportWorkRecord ID="ImportWorkRecord1" runat="server" /></ContentTemplate></ajaxToolkit:TabPanel>
                                        <ajaxToolkit:TabPanel ID="ImportHourTabPanel" runat="server"  HeaderText="<%$ Resources:ImportYearWorkRecord %>" visible="false"><ContentTemplate><My:ImportHour ID="ImportHour1" runat="server"></My:ImportHour></ContentTemplate></ajaxToolkit:TabPanel>
                                   </ajaxToolkit:TabContainer>
                                </td>
                            </tr>
                        </table><asp:ValidationSummary ID="sum_EditWorkRecordA" runat="server" 
    DisplayMode="List" ShowMessageBox="True"
                ShowSummary="False" ValidationGroup="EditWorkRecordA" /><asp:ValidationSummary ID="sum_ShowPersonA" runat="server" 
        DisplayMode="List" ShowMessageBox="True"
                ShowSummary="False" ValidationGroup="ShowPersonA" /> <asp:ValidationSummary ID="sum_AllA" runat="server" DisplayMode="List" ShowMessageBox="True"
                ShowSummary="False" ValidationGroup="AddWorkHeaderA" />
            <asp:ValidationSummary ID="sum_ExportA" runat="server" DisplayMode="List" ShowMessageBox="True"
                ShowSummary="False" ValidationGroup="Export" />
                  <asp:ValidationSummary ID="sum_Query" runat="server" ShowMessageBox="True"
            ShowSummary="false" ValidationGroup="vQuery" />    
<%--                    </ContentTemplate>
                </asp:UpdatePanel>--%>
            </td>
        </tr>
    </table>
</asp:Content>
